package com.fengycx.service.impl;

import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.RandomUtil;
import com.fengycx.mapper.DriverGeoMapper;
import com.fengycx.pojo.dto.DriverPointDto;
import com.fengycx.service.IDriverGeoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DriverGeoServiceImpl implements IDriverGeoService {

    @Autowired
    private DriverGeoMapper driverGeoMapper;

    /**
     * 实时缓存司机坐标进HBase
     * @param driverPoint
     */
    @Override
    public void cacheDriverLocation(DriverPointDto driverPoint) {
        driverPoint.setDriverId(StpUtil.getLoginIdAsLong());
        driverPoint.setId(RandomUtil.randomLong());
        driverGeoMapper.save(driverPoint);
    }


}
